package com.ahcfl.dao;

import com.ahcfl.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {


    @SelectProvider(type = UserSqlProvider.class,method = "findUserByPageAndUsername")
    public List<User> findUserByPageAndUsername(@Param("start") int start,
                                                @Param("pageSize") int pageSize,
                                                @Param("name") String name);

    @SelectProvider(type = UserSqlProvider.class,method = "findTotalUserByPageAndUsername")
    public int findTotalUserByPageAndUsername(@Param("name") String name);

    @Insert("insert into user values(null,#{name},#{sex},#{role},#{password},now(),#{email})")
    int save(User user);

    @Delete("delete from user where id = #{id}")
    int deteleUserById(int id);

    @Update("update user set name=#{name},password=#{password},email=#{email},role=#{role} where id=#{id}")
    int  updateUser(User user);
}
